fix(ci): skip import profiler on python version mismatch during install - #17784
Closed
hebaalazzeh wants to merge 1 commit into
Closed
fix(ci): skip import profiler on python version mismatch during install#17784hebaalazzeh wants to merge 1 commit into
hebaalazzeh wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the CI script ci/run_single_test.sh to capture the output of pip install and handle Python version incompatibility gracefully. The review feedback suggests deduplicating the cleanup logic (deactivating the virtual environment and removing temporary directories) within the error handling block to simplify the code.
Comment on lines
+142
to
+157
| if [ ${pip_retval} -ne 0 ]; then | ||
| echo "${pip_output}" | ||
| if echo "${pip_output}" | grep -q "requires a different Python"; then | ||
| echo "WARNING: Package ${PACKAGE_NAME} is not compatible with Python ${PY_VERSION}. Skipping import profiler." | ||
| deactivate | ||
| rm -rf .venv-profiler | ||
| rm -rf "${PROFILER_TEMP_DIR}" | ||
| exit 0 | ||
| else | ||
| echo "ERROR: Failed to install package ${PACKAGE_NAME}." | ||
| deactivate | ||
| rm -rf .venv-profiler | ||
| rm -rf "${PROFILER_TEMP_DIR}" | ||
| exit ${pip_retval} | ||
| fi | ||
| fi |
Contributor
There was a problem hiding this comment.
The cleanup logic (deactivate and removing temporary directories) is duplicated in both branches of the conditional check. This can be simplified by performing the cleanup immediately after printing the pip output, before checking the specific error message.
Suggested change
| if [ ${pip_retval} -ne 0 ]; then | |
| echo "${pip_output}" | |
| if echo "${pip_output}" | grep -q "requires a different Python"; then | |
| echo "WARNING: Package ${PACKAGE_NAME} is not compatible with Python ${PY_VERSION}. Skipping import profiler." | |
| deactivate | |
| rm -rf .venv-profiler | |
| rm -rf "${PROFILER_TEMP_DIR}" | |
| exit 0 | |
| else | |
| echo "ERROR: Failed to install package ${PACKAGE_NAME}." | |
| deactivate | |
| rm -rf .venv-profiler | |
| rm -rf "${PROFILER_TEMP_DIR}" | |
| exit ${pip_retval} | |
| fi | |
| fi | |
| if [ ${pip_retval} -ne 0 ]; then | |
| echo "${pip_output}" | |
| deactivate | |
| rm -rf .venv-profiler | |
| rm -rf "${PROFILER_TEMP_DIR}" | |
| if echo "${pip_output}" | grep -q "requires a different Python"; then | |
| echo "WARNING: Package ${PACKAGE_NAME} is not compatible with Python ${PY_VERSION}. Skipping import profiler." | |
| exit 0 | |
| else | |
| echo "ERROR: Failed to install package ${PACKAGE_NAME}." | |
| exit ${pip_retval} | |
| fi | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolves CI check failures on packages (such as
sqlalchemy-bigquery) that restrict Python versions usingpython_requiresconstraints (e.g.<3.15) when executing the import profiler on Python 3.15.Key Changes
ci/run_single_test.shto capture the output ofpip install -e .and inspect the stderr for"requires a different Python".0, gracefully skipping the import profiler run instead of crashing the job.